home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / Assembler.cpt / McAssembly Docs.text next >
Text File  |  1987-11-26  |  63KB  |  1,648 lines

  1. **************************************************************************
  2.  
  3.         McAssembly™ V7.4 Shareware Docs 
  4.         Copyright © 1986,87 By Signature Software
  5.  
  6. **************************************************************************
  7. (This document is layed out for Monaco 9, with tabs set to eight spaces.)
  8.  
  9. **************************************************************************
  10.             CHANGES IN VERSION 7.4
  11. **************************************************************************
  12.  
  13. * McAssembly is now "MultiFinder-friendly". This means two things:
  14.     1.) McAssembly's SIZE -1 resource is compatible with MultiFinder
  15.         and indicates to MF that McAssembly is "MF-aware". If you
  16.         find yourself running out of symbol table space when running
  17.         under MF, then increase the minimum and preferred sizes in
  18.         the SIZE -1 resource.
  19.     2.) McAssembly can run in the background under MF. This means that
  20.         you can run assemblies, links, and jobs as a background
  21.         process.
  22.  
  23. **************************************************************************
  24.             CHANGES IN VERSION 7.3
  25. **************************************************************************
  26.  
  27. * The trap compiler now supports the new 256K ROM (color) traps.
  28.  
  29. **************************************************************************
  30.             CHANGES IN VERSION 7.2
  31. **************************************************************************
  32.  
  33. * Fixed a bug in macro substrings - if substring length was longer than the
  34.     actual parameter string and if the substring didn't start in the
  35.     first position, then garbage was added to the string when it was
  36.     expanded.
  37.  
  38. **************************************************************************
  39.             CHANGES IN VERSION 7.1
  40. **************************************************************************
  41.  
  42. * Fixed a bug in the linker - included resources which had an odd length
  43.     were getting their fourth byte zapped to zero.
  44.  
  45. **************************************************************************
  46.             CHANGES IN VERSION 7.0
  47. **************************************************************************
  48.  
  49. * The assembler now supports 68010, 68020, and 68851 instructions.
  50.  
  51. **************************************************************************
  52.             CHANGES IN VERSION 6.9
  53. **************************************************************************
  54.  
  55. * STR resources with ID's greater than 999 are now used to build the Transfer
  56.     menu. This allows you to make your own transfer menu.
  57. * Raw data files can now have their types and signatures specified with
  58.     FTYPE and FSIGN.
  59. * BTST's are now allowed on PC-relative operands.
  60. * MOVE An,CCR is now illegal.
  61. * The linker's maximum resource size has been increased from 32K to 64K.
  62.  
  63. **************************************************************************
  64.             CHANGES IN VERSION 6.8
  65. **************************************************************************
  66.  
  67. * Added the ability to combine multiple user-defined resource module files
  68.     into one resource in the linker.
  69.  
  70. **************************************************************************
  71.             CHANGES IN VERSION 6.7
  72. **************************************************************************
  73.  
  74. * The status window is now moveable.
  75. * The main and status windows are now moveable across all of a large screen
  76.     display.
  77. * Save Options now also saves the sizes and locations of both windows.
  78.  
  79. **************************************************************************
  80.             CHANGES IN VERSION 6.6
  81. **************************************************************************
  82.  
  83. * Added the Print to Modem Port option in Misc. menu.
  84. * RSEC now takes an origin as in:   RSEC <orgexpr> [,An].
  85.  
  86. **************************************************************************
  87.             INTRODUCTION
  88. **************************************************************************
  89.  
  90.     This document briefly describes the McAssembly program - an assembler, 
  91. resource compiler, linker, and job controller for the Macintosh. McAssembly is 
  92. a shareware program - if you like it and use it, then please register it by 
  93. sending $50.00 to:
  94.  
  95.     Signature Software (checks payable to same)
  96.     2151 Brown Ave.
  97.     Bensalem, PA 19020        (215) 639-8764
  98.  
  99. All registered owners will receive the following:
  100.     • a 94-page manual
  101.     • the latest version of the program
  102.     • Apple's EDIT editor
  103.     • a symbolic debugger called McBug
  104.     • several example working applications source code files
  105.     • all of the standard Apple equate, trap, and .rel files in McAssembly
  106.         format (MPW Version 2.0 or later)
  107.     • a utility to convert McAssembly .rel files to MDS .rel files
  108.     • 24-hour, 7-day telephone support
  109.     (Supplied on two 400K MFS diskettes. All of the source and equate
  110.     files are in a packed format to conserve disk space. An unpacking
  111.     utility is provided.)
  112.  
  113.     I strongly recommend that you register it if you use it, just for the 
  114. additional examples and manual alone. (This document must of necessity be very 
  115. brief - the manual goes into much greater detail. The WriteNow manual files are 
  116. over 400K, which I thought was too much to expect people to download, so I've 
  117. condensed them into this text file.)
  118.  
  119.     To those of you who might object that this isn't a complete package 
  120. because I've not distributed everything that you should have (particularly the 
  121. system equate files and examples), I answer as follows:
  122.  
  123.     • The whole package takes up almost 800K of disk space - I can't 
  124. imagine anyone seriously wanting to download that! The $50.00 registration fee 
  125. is probably a wash when you consider the download charges, the time to download 
  126. and print the docs, and the aggravation. The documentation presented here, 
  127. while condensed, does represent all of the essential information that you need 
  128. to know to use the program, it's just a lot easier if you have the whole 
  129. package. In addition, don't forget that the whole package is a complete 
  130. assembly language development system. Something as complex as that hardly lends 
  131. itself to electronic distribution. In fact, I think I've done a masterful job 
  132. just in getting all of the information you need to use it in only this 50K 
  133. file.
  134.  
  135.     • Parts of the package are copyright by Apple Computer, and I can't 
  136. distribute them indiscriminately. I can supply them to registerees under the 
  137. terms of my license with Apple.
  138.  
  139.     • If you're an experienced Mac assembly language programmer, then the 
  140. information presented here is probably more than enough to get you going. If 
  141. you're converting from some other assembler to McAssembly, you may not even 
  142. need the whole package (although I would still expect you to register.) If 
  143. you're an inexperienced Mac programmer, then the examples in the registered 
  144. package, the system files, and my telephone support would probably be of value 
  145. to you, but I don't see how anyone could object to paying for those.
  146.  
  147.     • Given the current registration ratios of other Macintosh shareware 
  148. programs, what's wrong with having a little incentive to register?
  149.  
  150.  
  151.                 ____________________________________
  152.                 |                   |
  153.                 |  Dave McWherter    9/3/86     |
  154.                 |                                  |
  155.                 |  Compuserve 70057,1612           |
  156.                 |  Delphi     DMcWherter           |
  157.                 |  Genie      D.McWherter          |
  158.                 |__________________________________|
  159.  
  160.  
  161. **************************************************************************
  162.             THE MENU SELECTIONS
  163. **************************************************************************
  164.  
  165.     First, a description of the menu options:
  166.  
  167.     File menu:
  168.         Assemble    assembles a file
  169.         Link        links a group of files
  170.         Run job        executes a .job file
  171.         Save options    save current McAssembly options
  172.         Quit        what else?
  173.  
  174.     Assembler menu:
  175.         Object file        creates a .rel object file
  176.         Listing to printer    echoes output to printer
  177.         Listing to screen    echoes output to screen
  178.         Listing to file        echoes output to .lst file
  179.         Errors only listing    only outputs error lines
  180.         Symbol table        outputs symbol table at end
  181.         Cross reference        outputs cross reference table at end
  182.         Terse cref mode        removes unref'ed .PSM symbols from     
  183.                     cross reference list
  184.         .PSM file        creates a .PSM file
  185.         DEF all symbols        DEFs all non-.PSM symbols in the file
  186.         No listing headers    suppresses headers in listings
  187.         MPW object format    object file will be in MPW format, .o
  188.         Error lines to clip    copies error lines to clipboard
  189.  
  190.     Linker menu:
  191.         Symbol table        outputs symbol table at end
  192.         .MAP file output    echoes output to .map file
  193.         Printer output        echoes output to printer
  194.         McBug .SYM file        creates symbol file for use with McBug
  195.         Raw code data file    puts output code in data fork of file
  196.                         with no resource formatting
  197.         User .MAP file        creates a .map file in a user-defined
  198.                         format
  199.  
  200.     Jobs menu:
  201.         Stop if Asm error    stop the job if assembly error occurs
  202.         No link if Asm error    don't link if assembly error occurs
  203.         Force assemblies    force all files in job to be assembled
  204.  
  205.     Misc. menu:
  206.         Enable Beep        enable beep at end of commands
  207.         Use .Print driver    route printer output through the driver
  208.                     (else goes directly to serial port B)
  209.         Print to modem port    routes printer output to the modem port
  210.                     (only if Use .Print driver not enabled)
  211.  
  212.     Transfer menu:
  213.         default transfer string names which you can change with ResEdit
  214.         Other            transfers to any other program
  215.  
  216. **************************************************************************
  217.             SOURCE LINE FORMAT
  218. **************************************************************************
  219.  
  220.     All source code lines must be in the following form:
  221.  
  222.     [label]    opcode    [operand]    [;] [comment]
  223.  
  224.     Tabs or spaces separate fields, and >>> only one tab (or space) can 
  225. appear between the opcode field and the operand field <<<. Labels may contain 
  226. up to 100 characters, all of which are significant. Labels may contain 
  227. alphanumeric characters and any of the following characters: _, %, !, @, #, $, 
  228. ?, or period. Labels may be suffixed with a colon if desired.
  229.  
  230.     The semicolon comment designator character is optional in the majority 
  231. of cases. Specifically, if an opcode appears in the line then you can omit the 
  232. semicolon. If a line contains just a label and a comment, then you have to use 
  233. the semicolon.
  234.  
  235. **************************************************************************
  236.             ARITHMETIC EXPRESSIONS
  237. **************************************************************************
  238.  
  239.     All arithmetic and logical operations are 32-bit operations. McAssembly 
  240. supports the following operators and special characters.
  241.  
  242.     +    integer addition
  243.     -    integer subtraction
  244.     /    integer division (32 bits/32 bits = 32 bits)
  245.     *    integer multiplication (32 bits * 32 bits = 32 bits)
  246.     MOD    integer modulus
  247.     SHL    logical shift left (16 SHL 2 = 64)
  248.     <<    same as SHL
  249.     SHR    logical shift right (16 SHR 3 = 2)
  250.     >>    same as SHR
  251.     AND    logical bit AND
  252.     OR    logical bit OR
  253.     XOR    logical bit eXclusive-OR
  254.     NOT    logical bit inverse
  255.     'xxxx'    character constant (1-4 characters, right justified)
  256.     *    current value of program counter
  257.     $    specifies a hexadecimal number
  258.     %    specifies a binary number
  259.  
  260.         (The following relational operators return true or false;
  261.          true = $FFFFFFFF and false = 0.)
  262.  
  263.     <=    less than or equal
  264.     <>    not equal
  265.     >=    greater than or equal
  266.     <    less than
  267.     >    greater than
  268.     =    equal to
  269.  
  270.     The expression processor uses standard algebraic precedence rules. Use 
  271. parentheses to force precedence.
  272.  
  273. **************************************************************************
  274.             ALIGNMENT
  275. **************************************************************************
  276.  
  277.     McAssembly automatically aligns those things that must be on an even 
  278. address (opcodes, variable or constant words and longs, trap words, etc.) by 
  279. putting a zero byte in front of them if necessary. However, labels on 
  280. automatically aligned lines still carry the value of the address before the 
  281. alignment. These may be odd. If this happens, McAssembly warns you with a LABEL 
  282. ON ODD ADDRESS message. If that's what you really wanted, then you can ignore 
  283. the warning. Otherwise, you must change the code accordingly, probably by 
  284. adding an explicit ALIGN pseudo-op, and reassemble.
  285.  
  286. **************************************************************************
  287.             THE ASSEMBLER PSEUDO-OPS
  288. **************************************************************************
  289.  
  290.     (These are almost in alphabetical order. In some cases, pseudo-ops 
  291. which are used together are grouped together for description purposes.)
  292.  
  293.  
  294. A5OFF    <absolute expr>            specify initial A5 offset
  295. A5SEC                    define A5 offset variables
  296. A5END                    end an A5SEC
  297. A5REF    <symbol> [, <symbol>, ...]    reference an A5SEC variable
  298.  
  299. All global data which is to be stored offset from A5 must be defined between 
  300. A5SEC and A5END. You can have as many A5SEC's in a file as you want - the 
  301. linker concatenates them. A5OFF may be used to specify the initial offset below 
  302. A5 for all of your globals, and defaults to $100. A5REF is used to reference A5 
  303. variables which are defined in other modules. Symbols which are defined as A5 
  304. variables don't have to have the '(A5)' suffixed to them. For example:
  305.  
  306.         a5off    grafSize
  307.         a5sec
  308.     global1    ds.l    1
  309.     global2    ds.w    2
  310.         a5end
  311.         a5ref    external
  312.  
  313.         move    global1,d0    this is the same as...
  314.         move    global1(a5),d0        this
  315.         move    external,d0    and this is the same as...
  316.         move    external(a5),d0        this
  317.  
  318. ALIGN    [<expr>]    aligns the PC to a multiple of <expr>, default = 2
  319. .ALIGN    [<expr>]    aligns the PC to a multiple of <expr>, default = 2
  320.  
  321. BASE    An, <symbol> [,<symbol>, ...]    auto-offsets specified symbols by An
  322. BASE specifies that a symbol is to be offset by the specified address register 
  323. every time you use it For example, if you do this:
  324.  
  325.         base    a6,sym1,sym2
  326.         move    sym1,d0            then this instruction
  327.         move    sym1(a6),d0        is the same as this one and
  328.         move    sym1(a3),d0        you can override it if you want
  329.  
  330. BASE    An        auto-offset all subsequently defined symbols by An
  331. ENDB            turn off symbol basing (only necessary if no symbols
  332.                 are specified in the BASE operand list)
  333.  
  334. CASE    turns on case sensitivity
  335.  
  336. If you don't use CASE, then case in labels is not significant.
  337.  
  338.  
  339. DB    <expr> [, <expr>, ...]    define constant bytes at the PC
  340. DC    <expr> [, <expr>, ...]    define constant words at the PC
  341. DC.B    <expr> [, <expr>, ...]    define constant bytes at the PC
  342. DC.L    <expr> [, <expr>, ...]    define constant longs at the PC
  343. DC.W    <expr> [, <expr>, ...]    define constant words at the PC
  344. DL     <expr> [, <expr>, ...]    define constant longs at the PC
  345. DW     <expr> [, <expr>, ...]    define constant words at the PC
  346.  
  347. DCB     <count>, <value>    define block of <count> bytes of <value>
  348. DCB.B    <count>, <value>    define block of <count> bytes of <value>
  349. DCB.L     <count>, <value>    define block of <count> longs of <value>
  350. DCB.W     <count>, <value>    define block of <count> words of <value>
  351. FILL     <count>, <value>    equivalent to DCB
  352.  
  353. DEF     <symbol> [, <symbol>, ...]    externally define symbols
  354. XDEF     <symbol> [, <symbol>, ...]    externally define symbols
  355.  
  356. DEF and XDEF are equivalent - they allow symbols in this file to be referenced 
  357. from another file.
  358.  
  359. DEFALL
  360.  
  361. Same as DEF'ing every symbol in the file.
  362.  
  363. DEFINE    "string"        define a string symbol; the symbol may then be
  364.                     used anywhere in a source line between
  365.                     curly brackets and will cause a string
  366.                     replacement before the line is
  367.                     assembled. For example:
  368.  
  369.     hello    define    "goodbye"    if you define hello to be 'goodbye'
  370.         text    "* {hello} *"    then this string will be '* goodbye *'
  371.  
  372. DSEC     <absolute expr> [<An]    start dummy section, org'ed at <absolute expr>,
  373.                     base all labels inside to An
  374.  
  375. DSEC    [<symbol>]        end a DSEC, symbol is set to size of the DSEC
  376.  
  377. RSEC    <absolute expr> [,An]    begin reverse DSEC, org'ed at <absolute expr>,
  378.                     optionally BASE all labels inside to An
  379.                     (default A6)
  380. ENDR    [<symbol>]        end an RSEC, symbol set to size of the section
  381.  
  382.  
  383. DSEC and DEND delimit "dummy sections", which may contain only storage 
  384. allocation statements. No storage is actually allocated for items in a dummy 
  385. section - their primary use is to assign values to record structures. Only 
  386. storage allocation statements are allowed in dummy sections. For example:
  387.  
  388.         dsec    1
  389.     sym1    ds.b    1    will have a value of 1
  390.     sym2    ds.w    1    will have a value of 2
  391.     sym3    ds.l    1    will have a value of 4
  392.         dend
  393.  
  394. Dummy sections may also be defined in 'reverse' using RSEC, for example:
  395.  
  396.         rsec    0
  397.     sym1    ds    0    will have a value of  0
  398.     sym2    ds.w    1    will have a value of -2
  399.     sym3    ds.l    1    will have a value of -6
  400.     sym4    ds.w    1    will have a value of -8
  401.         endr    rsize    rsize will have a value of 8
  402.  
  403. DS     <count>        define <count> words of storage at PC
  404. DS.B    <count>        define <count> bytes of storage at PC
  405. DS.L     <count>        define <count> longs of storage at PC
  406. DS.W     <count>        define <count> words of storage at PC
  407.  
  408. BOOLEAN    <count>        same as ds.w (These allow more mnemonic DS's...)
  409. BYTE    <count>        same as ds.b    "    "    "    "
  410. CHAR    <count>        same as ds.w    "    "    "    "
  411. HANDLE    <count>        same as ds.l    "    "    "    "
  412. HDL    <count>        same as ds.l    "    "    "    "
  413. INTEGER    <count>        same as ds.w    "    "    "    "
  414. LONG    <count>        same as ds.l    "    "    "    "
  415. LONGINT    <count>        same as ds.l    "    "    "    "
  416. POINT    <count>        same as ds.l    "    "    "    "
  417. POINTER    <count>        same as ds.l    "    "    "    "
  418. PTR    <count>        same as ds.l    "    "    "    "
  419. RECT    <count>        same as ds.b  8*<count>
  420. VAR    <count>        same as ds.l    "    "    "    "
  421. WORD    <count>        same as ds.w    "    "    "    "
  422.  
  423.  
  424. IF     <absolute expr>        conditional assembly
  425. ELSE                used with IF
  426. ENDI                end an IF clause
  427. ENDIF                end an IF clause
  428. IFDEF    <symbol>        true if symbol defined
  429. IFNDEF    <symbol>        true if symbol undefined
  430. IF1                true if pass 1
  431. IF2                true if pass 2
  432.  
  433. Conditional assembly control. For example:
  434.  
  435.         if    0    the expr is not true, so
  436.         <statements>        these statements aren't assembled
  437.         else                (else clauses are optional)
  438.         <statements>        but these statements are
  439.         endi
  440.  
  441. IFLIST    <expr>            conditional listing control
  442.  
  443. If the expression is true (the default condition), then conditional assembly 
  444. clauses which aren't assembled will appear in the listing, otherwise they 
  445. won't.
  446.  
  447. END        end of program (optional)
  448.  
  449. EQU    <expr>        equate symbol to <expr>
  450. EQU.B    <expr>        equate symbol to <expr>    (equivalent to equ)
  451. EQU.W    <expr>        equate symbol to <expr>    (equivalent to equ)
  452. EQU.L    <expr>        equate symbol to <expr>    (equivalent to equ)
  453.  
  454. ERROR    "your error message"
  455.  
  456. Allows user-definable assembly errors.
  457.  
  458. FSIGN     <absolute expr>        specify program's Finder file signature
  459. FTYPE     <absolute expr>        specify program's Finder file type
  460.  
  461. For example, if you're assembling an application, then:
  462.  
  463.         ftype    'APPL'
  464.         fsign    'ursg'
  465.  
  466. Or, if you're assembling a desk accessory to be installed by the Font/DA Mover:
  467.  
  468.         ftype    'DFIL'
  469.         fsign    'DMOV'
  470.  
  471. IPATH    "pathname"    specify an HFS path to subsequent include files
  472. INCL    "filename"    include another source file
  473. INCLUDE    "filename"    include another source file
  474.  
  475. JTBL       <symbol> [, <symbol>, ...]    specify jump table entries
  476.  
  477. Any symbol that's referenced from another segment by a Bcc, DBcc, JSR, JMP, 
  478. LEA, or PEA instruction >>> must <<< be specified as a jump table entry.
  479.  
  480. LINE    [ <char> [ , <count> ] ]    prettyprint a line of chars
  481.  
  482. Outputs a listing line filled with the specified number of characters. <count> 
  483. defaults to 50, and <char> defaults to '*'.
  484.  
  485. LIST    <absolute expr>        listing control
  486.  
  487. If the expression is true (not 0), then subsequent source lines appear in the 
  488. listing, otherwise they won't.
  489.  
  490.  
  491. LFRAME    [An]        begin local variable stack frame, and BASE symbols     
  492.             inside to An (default A6)
  493. ENDL    [<symbol>]    end a LFRAME, symbol is set to size of the frame
  494.  
  495. LFRAME and ENDL allow local variables which are to be stored on the stack to be 
  496. easily defined. Symbols defined within the frame are automatically BASE'd to 
  497. the specified register so that you don't have to suffix them with '(An)'. For 
  498. example:
  499.  
  500.         lframe
  501.     local1    integer        will have an a6 offset of -2
  502.     local2    longint        will have an a6 offset of -6
  503.     local3    rect        will have an a6 offset of -14
  504.         endl    lsize    will have a value of 14
  505.  
  506.     Subroutine_Entry
  507.         link    a6,#-lsize    save stack space for locals
  508.         move    local1,d0    this instruction is the same as...
  509.         move    -2(a6),d0        this one
  510.         ...
  511.         unlk    a6        clear locals from stack
  512.         rts            return
  513.  
  514.  
  515. LOC            start new local scope block
  516. LOCSYM    <expr>        change local label character
  517. NOLOC            auto-LOC on non-local labels
  518.  
  519. Local symbols begin with a period and may contain the same cast of characters 
  520. as normal labels. Their scope normally extends from one LOC statement to the 
  521. next LOC statement. This can be changed with the NOLOC statement, which causes 
  522. local symbol scopes to extend from one non-local label to the next non-local 
  523. label. The local symbol prefix character can be changed with the LOCSYM 
  524. statement. For example,
  525.  
  526.             loc
  527.         .hello    nop        this .hello
  528.             loc
  529.         .hello    nop        is different than this .hello
  530.         .hello    nop        but this .hello causes an error
  531.  
  532. Or, using NOLOC, and LOCSYM (for MDS compatibility):
  533.  
  534.             noloc
  535.             locsym    '@'
  536.         goodbye    nop
  537.         @hello    nop        this @hello
  538.         solong    nop
  539.         @hello    nop        is different than this @hello
  540.         @hello    nop        but this @hello causes an error
  541.  
  542.  
  543. MACRO    [&1,&2,...,&F]        begin a macro definition
  544. MACROX    [&1,&2,...,&F]        ditto, no auto LOC on call
  545. ENDM                end a macro definition
  546. MEXP     <absolute expr>        macro expansion control
  547.  
  548. These control macros. For example, given a macro called test defined as:
  549.  
  550.         test    macro    &1,&2,&3,&4,&5,&6
  551.             move    &1,d0
  552.             lea    &2,a0
  553.             if    &&3 = "hello"
  554.             nop
  555.             endi
  556.             text    &&4        notice quote enclosure
  557.         lab%5    nop            notice expand as value string
  558.             &6            parameters may be opcodes
  559.             text    "&2[2:3]    param substring [start:length]
  560.             endm
  561.  
  562. And a call to test like this:
  563.  
  564.         num    equ    1234
  565.             test    d2,symbol,hello,mikey,num,_Open
  566.  
  567. Then it would be expanded to the following:
  568.  
  569.             move    d2,d0
  570.             lea    symbol,a0
  571.             nop
  572.             text    "mikey"
  573.         lab1234    nop
  574.             _Open
  575.             text    "ymb"
  576.  
  577. MACROs do an automatic LOC on entry so that local symbols inside the macro have 
  578. their own scope. This prevents local symbols inside the macro from conflicting 
  579. with local symbols outside it. MACROX's do not do the LOC - so that you can 
  580. pass local symbols to a macro if you want. MEXP controls whether or not macro 
  581. expansions appear in the listing: they will appear if the expression is true.
  582.  
  583.  
  584. M68000        only allow 68000 instructions and addressing modes (this is
  585.             the default mode)
  586. M68010        only allow 68000 and 68010 instructions and addressing modes
  587. M68020        allow 68000, 68010, and 68020 instructions and addressing modes
  588.  
  589. NAME    <symbol>    specifies the module name (one source file is a module)
  590.  
  591. PAGE    ["title"]    page eject, optionally specifying a page title
  592.  
  593. PFRAME    [An]        begin parameter stack frame, and BASE symbols inside to 
  594.                 An (default A6)
  595. ENDP    [<symbol>]    end a PFRAME, symbol is set to size of the frame
  596.  
  597. PFRAME and ENDP allow parameters passed on the stack to subroutines to be 
  598. easily defined. For example, suppose you have a subroutine whose Pascal 
  599. definition is:
  600.  
  601.    FUNCTION  Slush (parm1: LONGINT; parm2: INTEGER; parm3: BOOLEAN) : INTEGER;
  602.  
  603. Then you could code it in McAssembly as follows:
  604.  
  605.             pframe
  606.         result    integer        will have an a6 offset of 16
  607.         parm1    longint        will have an a6 offset of 12
  608.         parm2    integer        will have an a6 offset of 10
  609.         parm3    boolean        will have an a6 offset of 8
  610.             endp    psize    will have a value of 10
  611.  
  612.         Slush    link    a6,#0
  613.             move    parm2,d0    then this is equivalent to
  614.             move    10(a6),d0        to this
  615.             ...
  616.             move    d0,result    returns the result
  617.             unlk    a6
  618.             move.l    (sp)+,a0    get return address
  619.             addi.l    #psize-2,sp    clear parameters (leave result)
  620.             jmp    (a0)        and return
  621.  
  622. Notice that PFRAME automatically allocates space for a stacked return address 
  623. and a stacked linkage register, so you have to do a 'link' instruction on entry 
  624. to the routine if you use PFRAME. The ENDP is optional is you have an LFRAME 
  625. immediately following.
  626.  
  627.  
  628. PRMT    "prompt"        display a prompt on the screen
  629. PRTR    "string"        send ctrl string to printer
  630. PSIZE     <absolute expr>        set listing page size
  631.  
  632. REF     <symbol> [, <symbol>, ...]    reference external symbols
  633. XREF     <symbol> [, <symbol>, ...]     reference external symbols
  634.  
  635. REF and XREF are equivalent and allow you to reference symbols which are 
  636. defined in other modules.
  637.  
  638.  
  639. REQU    Dn | An | <register symbol>    equate symbol to a register
  640.  
  641. For example:
  642.  
  643.         dataptr    requ    a4
  644.             move.l    (dataptr),d0    then this is the same as...
  645.             move.l    (a4),d0            this
  646.         bufptr    equ    dataptr
  647.             move.l    bufptr,d1    and this...
  648.             move.l    a4,d1            is the same as this
  649.  
  650.  
  651. RPATH    "pathname"    specify an HFS path for the .rel object file
  652.  
  653. SET    <expr>        set symbol to value, may be reSET again
  654.  
  655. STRING    <expr>        set DC.B string formats:
  656.                 0 = no length byte prefixes (default)
  657.                 else prefix with length bytes
  658.  
  659. TABS     <n>        specify listing tab stops every <n> columns
  660.  
  661. TCOMP            activate the trap compiler (described later)
  662.  
  663. TERSE            set short listing format (no line numbers, 16 bits of     
  664.             program counter)
  665.  
  666.  
  667. TEXP     <absolute expr>        text expansion control
  668.  
  669. If the expression is 0, then only one line of object bytes appears in the 
  670. listing for a TEXT statement. Otherwise all of the bytes generated by the text 
  671. will appear in the listing.
  672.  
  673. TEXT    [ - | + | # ] "string"        define a text string
  674.  
  675. '-' sets bit 7 on the last byte of the string. '+' sets bit 7 in every string 
  676. byte (Apple ][ forever!). '#' stuffs a length byte in front of the string. 
  677. (Only one prefix is allowed at a time.) You can use the following escape 
  678. characters in the string:
  679.  
  680.         /R    carriage return        $0D
  681.         /L    linefeed        $0A
  682.         /"    double quote        $22
  683.         /T    tab            $09
  684.         /E    escape            $1B
  685.         /0    null            $00
  686.         //    slash            $2F
  687.         /F    formfeed        $0C
  688.         /B    backspace        $08
  689.         /$hh    any hex number        $hh
  690.         /'    single quote        $27
  691.         /D    current date
  692.         /S    select short date form
  693.         /U    select unabbreviated long date form
  694.         /A    select abbreviated long date form (the default)
  695.  
  696. For example:
  697.  
  698.         text    #"ABC"        generates 05 41 42 43
  699.         text    +"ABC"        generates C1 C2 C3
  700.         text    -"ABC"        generates 41 42 C3
  701.         text    "ABC/T/$21/R"    generates 41 42 43 09 21 0D
  702.  
  703.  
  704. TITLE    "string [$] "    specify listing page title, '$' generates a timestamp
  705.  
  706. TRAPW     <absolute expr>    define a trap word
  707. OPWORD    <absolute expr>    define a trap word
  708.  
  709. For example:
  710.  
  711.     _Open    trapw    $A003
  712.         _Open
  713.  
  714. **************************************************************************
  715.             STRING DELIMITERS
  716. **************************************************************************
  717.  
  718.     In all of the above pseudo-op descriptions, strings have been shown 
  719. delimited by double quotes as in "string". However, you may also delimit them 
  720. with single quotes as in 'string'. The only place you can't use single quotes 
  721. as delimiters is in IF comparisons (because then the single quoted item would 
  722. be evaluated as a character constant.)
  723.  
  724. **************************************************************************
  725.             .PSM FILES
  726. **************************************************************************
  727.  
  728.     Packed symbol files are binary files containing only symbol 
  729. definitions. They're smaller in size than their text equivalents. This saves 
  730. disk space and speeds up assembly. They also speed up assembly because they're  
  731. read only on the first pass of the assembly. They're not read on the second 
  732. pass. Packed symbol files have a filename suffix of .PSM.
  733.  
  734.     You can create a file of symbol definitions from any source file. Just 
  735. select the assembler .PSM file option and assemble the file. McAssembly dumps 
  736. all the names of all symbols defined in the file and their values to a .PSM 
  737. file at the end of the assembly.
  738.  
  739.     You use .PSM files by INCLuding them in your source files.
  740.  
  741.     Symbols that are defined in more than one INCLuded .PSM file are not 
  742. flagged as multiply defined symbols. The symbol takes the value of the last 
  743. definition of it processed by McAssembly. This allows you to use .PSM files 
  744. containing overlapping symbol definitions without worrying about multiple 
  745. definitions.
  746.  
  747. **************************************************************************
  748.             THE TRAP COMPILER
  749. **************************************************************************
  750.  
  751.     McAssembly contains a built-in Trap Compiler which allows certain 
  752. toolbox and O/S traps to be invoked with one line of source code. It eliminates 
  753. much of the drudgery from trap setup and interfacing. For brevity, we'll call 
  754. the Trap Compiler simply the TC throughout the rest of this section.
  755.  
  756.     The TC was designed to simplify interfacing to the Macintosh 
  757. stack-based traps. Stack-based traps are those traps which pass parameters and 
  758. return results on the 68000 stack. (As opposed to register-based traps, which 
  759. pass parameters and return results in 68000 registers.) Interfacing to 
  760. stack-based traps requires a standard sequence of steps which are common to all 
  761. such traps: 
  762.  
  763.     1.) If the trap is a function, make room on the stack for the function     
  764.     result.
  765.     2.) Push the parameters on the stack.
  766.     3.) Execute the trap.
  767.     4.) If the trap is a function, remove the function result from the     
  768.     stack.
  769.  
  770. This standard sequence requires a large amount of source code overhead each 
  771. time a trap is called. Not only is this process tedious to code, but it is also 
  772. prone to errors. The purpose of the TC is two-fold: to eliminate the coding 
  773. overhead and to automate the sequence as much as possible in order to eliminate 
  774. coding errors.
  775.  
  776.     The TC is not available for use unless you specifically invoke it by 
  777. using the TCOMP pseudo-op. If you want to use the TC, just specify TCOMP at the 
  778. beginning of your source file. TCOMP loads the symbol table with special highly 
  779. encoded macrox definitions of all the stack-based traps.
  780.  
  781.     Once you've activated the TC with TCOMP, you can then invoke any 
  782. stack-based trap by specifying the name of the trap as an opcode and follow it 
  783. with a list of parameters as operands like this:
  784.  
  785.     TrapName <tab> param1, param2,...,paramn [,=result]
  786.  
  787. Notice that TrapName is not preceded by an underscore character. This allows 
  788. you to bypass the TC and manually invoke all of the traps by using the trap 
  789. name preceded by an underscore.
  790.  
  791.     The list of parameters param1...paramn varies depending on the trap 
  792. you're calling. The parameters in the list correspond exactly to the PASCAL 
  793. definitions of the traps in Inside Macintosh. Some traps don't have any 
  794. parameters, in which case you don't specify any. The contents of the parameters 
  795. you specify are automatically pushed onto the stack for you by the TC. The size 
  796. of the item pushed (byte, word, long) is also automatically taken care of for 
  797. you by the TC.
  798.  
  799.     In some cases, you'll want to use the address of a symbol as a 
  800. parameter instead of its contents. The TC allows you to do that by specifying 
  801. an exclamation point character ! in front of the parameter. Note that ! is only 
  802. allowed on parameters of size long.
  803.  
  804.     The =result item is only used on functions. If the trap returns a 
  805. result on the stack, then it's a function and you have to specify where you 
  806. want the result to be stored. In the case of functions, the TC automatically 
  807. creates room on the stack for the function result before stacking any input 
  808. parameters and pops the result off the stack after the trap returns and stores 
  809. it in the result parameter you specify (again, taking care of sizing 
  810. automatically.) The = before a result item is optional. It's only purpose is to 
  811. improve readability of your code.
  812.  
  813.     All of this may sound complex, but it's really pretty easy to use. 
  814. Examples are a better way to explain it, so...
  815.  
  816. AN EXAMPLE
  817.  
  818.     Here's an example of using the TC. We'll use the Menu Manager trap 
  819. _NewMenu which has a PASCAL definition of:
  820.  
  821.     function NewMenu (menuID:INTEGER; menuTitle:Str255) : MenuHandle
  822.  
  823. Here's a code fragment using this trap:
  824.  
  825.             tcomp            turn on the trap compiler
  826.  
  827.     ourTitle    text    #"Example"    parameters we'll need
  828.     ourMenu    equ    100
  829.             a5sec
  830.     MHandle    ds.l    1
  831.             a5end
  832.  
  833.             NewMenu    #ourMenu,!ourTitle,=MHandle
  834.  
  835. This trap call would be expanded by the TC to the following sequence:
  836.  
  837.             subq.l    #4,sp
  838.             move.w    #ourMenu,-(sp)
  839.             pea    ourTitle,-(sp)
  840.             dc.w    $A931
  841.             move.l    (sp)+,MHandle
  842.  
  843. Notice that in this example we needed the address of the title so we prefixed 
  844. ourTitle with !.
  845.  
  846.     Let's use the same trap for another example. Assume that this time we 
  847. have computed the value of the menu ID and the address of the title string 
  848. dynamically. Assume further that the menu ID is in register D1 and the title 
  849. string address is in A2. We would then invoke the trap as follows:
  850.  
  851.             NewMenu    d1,a2,a0
  852.  
  853. Which would expand to:
  854.  
  855.             subq.l    #4,sp
  856.             move.w    d1,-(sp)
  857.             move.l    a2,-(sp)
  858.             dc.w    $A931
  859.             move.l    (sp)+,a0
  860.  
  861. Notice that this time we didn't specify the = to indicate a function result. 
  862. This is perfectly acceptable but not as readable. Also notice that we stored 
  863. the result in register A0 as opposed to MHandle.
  864.  
  865. A NAMING QUIRK
  866.  
  867.     There are two stack-based traps which have the same names as McAssembly 
  868. opcodes: the QuickDraw traps Move and Line. To avoid conflicts, if you want to 
  869. use the TC on these traps, be aware that they're renamed QDMove and QDLine in 
  870. the TC. You have to use these new names if you want the TC to recognize these 
  871. two traps.
  872.  
  873. WHAT TRAPS AREN'T RECOGNIZED
  874.  
  875.     The trap compiler doesn't contain definitions for the following traps 
  876. (because they're register-based):
  877.  
  878.     Device Manager
  879.     File Manager
  880.     Memory Manager
  881.     OS Event Manager
  882.     OS Utilities
  883.     Segment Loader
  884.  
  885.     In addition, only the following packages are supported:
  886.  
  887.     International
  888.     Standard File
  889.     Disk Initialization
  890.     SCSI Manager
  891.     List Manager
  892.     Color Picker
  893.     Script Manager
  894.     ShutDown Manager
  895.  
  896.     (The trap compiler contains definitions for all of the stack-based Mac+ 
  897. traps for the 128K ROM and Mac II color traps for the 256K ROM.)
  898.  
  899. USING IT WITH .PSM FILES
  900.  
  901.     There are naming conflicts between the names recognized by the TC and 
  902. some equates in the .PSM files. In particular, some "routine selector" equates 
  903. will cause conflicts. For example, SFGetFile is both a legal TC trap name and a 
  904. routine selector equate in the PackMacs.PSM file. If you want to use the TC 
  905. with the .PSM files, then you must activate it after you've included the .PSM 
  906. files!. In other words, don't use TCOMP until after all of your includes. If 
  907. you do this, then the symbols which are in both files will be forced to be trap 
  908. compiler names. The duplicated symbols will no longer be available as equated 
  909. values. Which is what you want, since if you're using the TC, then you won't 
  910. need the routine selector equates.
  911.  
  912. **************************************************************************
  913.             THE RESOURCE COMPILER
  914. **************************************************************************
  915.  
  916.  
  917.     McAssembly contains a built-in Resource Compiler which can assemble 
  918. resource definitions. A two-character resource delimiter at the start of a 
  919. source line identifies resource definitions. The delimiter sequence $$ starts a 
  920. standard resource definition, a definition of a resource type that McAssembly 
  921. knows how to interpret. The delimiter sequence [[ starts a user-defined 
  922. resource definition, a definition of a resource type that McAssembly doesn't 
  923. know how to interpret. The delimiter sequence ]] ends a user defined resource 
  924. definition. Standard resource definitions don't require an ending delimiter 
  925. because McAssembly knows where the resource definition ends from information 
  926. you supply in the definition.
  927.  
  928.     The formats of the two types of definitions are as follows:
  929.  
  930.     $$ TYPE, ID, ATTR, NAME [<tab>] [;] [comment]
  931.     <item list>
  932.  
  933.     or
  934.  
  935.     [[ TYPE, ID, ATTR, NAME [<tab>] [;] [comment]
  936.     <code and/or data>
  937.     ]]
  938.  
  939.  
  940.     TYPE is a four-character resource type. For standard definitions, it 
  941. must be one that McAssembly recognizes. For a user-defined definition, it can 
  942. be any four characters. ID is the resource ID number. ATTR specifies the 
  943. attribute byte for the resource. NAME is the name string of the resource. ATTR 
  944. and NAME are optional parameters and may be omitted, although you can't omit 
  945. the ATTR if you want to specify a NAME. Here are two examples for a standard 
  946. resource, one with all parameters specified, and one with ATTR and NAME 
  947. omitted:
  948.  
  949.     $$ ALRT, 2, 0, alert no. 2
  950.  
  951.     $$ WIND, 1
  952.  
  953.     The item list is simply a list of items that make up the resource 
  954. definition. McAssembly interprets each item in the list in a certain way. The 
  955. types of items you specify in the list must correspond exactly with the types 
  956. of items that McAssembly expects for that resource. If you specify an item of 
  957. the wrong type or if you specify too many or too few items, you'll get syntax 
  958. errors (many) on subsequent lines of the file. 
  959.  
  960.     Items in the item list appear at the beginning of subsequent source 
  961. lines after the line containing the $$. The format of lines in the item list is 
  962. as follows:
  963.  
  964.     item [, item, ...] [<tab>] [;] [comment]
  965.     item [, item, ...] [<tab>] [;] [comment]
  966.     etc... for as many lines as it takes to specify all items
  967.  
  968. As you can see, you have your choice of entering each item on its own source 
  969. line, or of placing several items on one line, or a combination of either. 
  970. McAssembly ignores all subsequent characters on the line after a tab or ; 
  971. character and skips to the start of the next line for the next item in the 
  972. list.
  973.  
  974.     There are several types of items. The type of each is marked in the 
  975. descriptions of the formats for each standard resource. These types have the 
  976. following meanings:
  977.  
  978.     bexp    an expression interpreted as a byte
  979.     wexp    an expression interpreted as a word
  980.     lexp    an expression interpreted as a long
  981.     chrl    a four-character long
  982.     str    a string
  983.  
  984.     bexp, wexp, and lexp items are numeric expressions and can be any legal 
  985. McAssembly expression. In most cases, you don't have to worry about what size 
  986. the expression is. In some cases you do, particularly in the bit maps, which 
  987. McAssembly interprets as a sequence of longwords.
  988.  
  989.     Enter chrl items as a sequence of from one to four characters. If you 
  990. specify fewer than four characters, then the item is left justified in a 32-bit 
  991. long and padded on the right with spaces. Don't enclose the characters in 
  992. quotation marks.
  993.  
  994.     You may enter strings in either of two ways. First, if your string 
  995. contains no special characters or leading spaces you can just type the string. 
  996. If it does contain special characters or leading spaces, you must enclose the 
  997. string in quotation marks as "string".  (Any of the escape sequences allowed in 
  998. TEXT strings are allowed in string.) If your string isn't enclosed in quotation 
  999. marks, then you can continue the string to the start of the next line by ending 
  1000. the string with a \ character. Strings enclosed in quotes can't be continued to 
  1001. the next line. You can specify a null string (a string with a length of zero) 
  1002. with the vertical bar |.
  1003.  
  1004.     The code and/or data in a user-defined resource may be any combination 
  1005. of legal McAssembly instruction opcodes or pseudo-ops. The definition must end 
  1006. with the ]] delimiter or you'll get an error message.
  1007.  
  1008. STANDARD RESOURCE FORMATS
  1009.  
  1010.     What follows is a list of the standard resource types that McAssembly 
  1011. recognizes and the formats of the item lists for each. Each item in these 
  1012. formats appears on its own source line but that doesn't have to be the case. 
  1013. They're only shown that way here for clarity.
  1014.  
  1015. ----------------------------------------------------------------------------
  1016.  
  1017. $$ ALRT,ID,ATTR,NAME
  1018. TOP        wexp    bounds rectangle:
  1019. LEFT        wexp
  1020. BOTTOM        wexp
  1021. RIGHT        wexp
  1022. DITL_LIST_ID    wexp    resc ID of item list
  1023. STAGES        wexp    see DLOG Mgr, IM, page 35
  1024.  
  1025. ----------------------------------------------------------------------------
  1026.  
  1027. $$ BNDL,ID,ATTR,NAME
  1028. SIGNATURE        chrl    application's signature
  1029. VERS_DATA_RESC_ID    wexp    0 by convention
  1030. NO_RESC_TYPES        wexp    no. of BNDL resc types that follow:
  1031.  
  1032. For each resc type:
  1033. RESOURCE_TYPE        chrl    typically ICN# or FREF
  1034. NO_MAPPINGS_THIS_TYPE    wexp    no. of mappings that follow:
  1035.  
  1036. For each mapping:
  1037. LOCAL_ID    wexp
  1038. ACTUAL_ID    wexp
  1039.  
  1040.  
  1041. ** Note: If you use the standard BNDL resource in a module, then McAssembly
  1042. automatically sets the bundle bit in the output file after the link is 
  1043. completed.
  1044.  
  1045. ----------------------------------------------------------------------------
  1046.  
  1047. $$ CNTL,ID,ATTR,NAME
  1048. TOP            wexp    bounds rectangle:
  1049. LEFT            wexp
  1050. BOTTOM            wexp
  1051. RIGHT            wexp
  1052. INITIAL_VALUE        wexp    current value of control
  1053. VISIBLE            wexp    boolean
  1054. MAX_VALUE        wexp    maximum value of control
  1055. MIN_VALUE        wexp    minimum value of control
  1056. CTRL_DEFINITION_ID    wexp    resc ID of the definition function for
  1057.                        the control type:
  1058.                         0  simple button
  1059.                         1  check box
  1060.                         2  radio button
  1061.                         8  add to use window's font
  1062.                         16 scroll bar
  1063. REFCON            lexp    user defined value
  1064. TITLE            str    the control's title
  1065.  
  1066. ----------------------------------------------------------------------------
  1067.  
  1068. $$ CURS,ID,ATTR,NAME
  1069. CURSOR_DATA_BYTES    lexp    eight longs of cursor image:
  1070.    "    lexp
  1071.    "     lexp
  1072.    "     lexp
  1073.    "     lexp
  1074.    "     lexp
  1075.    "     lexp
  1076.    "     lexp
  1077. CURSOR_MASK_BYTES    lexp    eight longs of cursor mask:
  1078.    "     lexp
  1079.    "     lexp
  1080.    "     lexp
  1081.    "     lexp
  1082.    "     lexp
  1083.    "     lexp
  1084.    "     lexp
  1085. H_OF_HOT_SPOT        wexp    horizontal of the hot spot
  1086. V_OF_HOT_SPOT        wexp    vertical of the hot spot
  1087.  
  1088. ----------------------------------------------------------------------------
  1089.  
  1090. $$ DITL,ID,ATTR,NAME
  1091. NO_ITEMS_IN_LIST    wexp    no. of items in this list:
  1092.  
  1093. For each item in the list:
  1094. HANDLE_HOLDER        lexp    placeholder for handle or pointer - normally 0
  1095. TOP            wexp    display rectangle (local coordinates):
  1096. LEFT            wexp
  1097. BOTTOM            wexp
  1098. RIGHT            wexp
  1099. ITEM_TYPE        bexp    type of the item:
  1100.                     0   user defined (dialog only)
  1101.                     4   std button control
  1102.                     5   std check box control
  1103.                     6   std radio button control
  1104.                     7   defined in CTRL template
  1105.                     8   static text
  1106.                     16  editable text (dialog only)
  1107.                     32  icon
  1108.                     64  QuickDraw picture
  1109.                     128 add to any of above to disable
  1110. ITEM    ----            the actual item; contents of this field
  1111.                 depend on item type as follows:
  1112.                 If item type is, then content is:
  1113.                    4,5,6    str    control title
  1114.                    7    wexp    resc ID of template
  1115.                    8,16    str    the text
  1116.                    32,64    wexp    resc ID of ICON or PICT
  1117.                     0    nil    empty (length = 0)
  1118.  
  1119. ----------------------------------------------------------------------------
  1120.  
  1121. $$ DLOG,ID,ATTR,NAME
  1122. TOP            wexp    bounds rectangle:
  1123. LEFT            wexp
  1124. BOTTOM            wexp
  1125. RIGHT            wexp
  1126. WINDOW_DEFINITION_ID    wexp    the type of window:
  1127.                     0  std doc wind or modeless dialog box
  1128.                     1  alert box or modal dialog box
  1129.                     2  plain box
  1130.                     3  plain box with shadow
  1131.                     4  doc window without size box
  1132.                     16 rounded corner window
  1133. VISIBLE            wexp    boolean, initial state of dialog
  1134. GOAWAY            wexp    boolean, TRUE means window has a close box
  1135. REFCON            lexp    user defined value
  1136. RESC_ID_OF_ITEM_LIST    wexp    resc ID of the DITL for this dialog
  1137. TITLE            str    the dialog's title (0 length string if modal     
  1138.                 dialog box)
  1139.  
  1140. ----------------------------------------------------------------------------
  1141.  
  1142. $$ FREF,ID,ATTR,NAME
  1143. FILETYPE        chrl    typically APPL
  1144. LOCAL_ID_FOR_ICON_LIST    wexp
  1145. FILENAME        str    filename that should follow the file
  1146.                         to a new disk (null string if none) 
  1147.  
  1148. ----------------------------------------------------------------------------
  1149.  
  1150. $$ ICON,ID,ATTR,NAME
  1151. (32) ICON_BYTE_LONGS    lexp    icon bit map - 32 longs:
  1152. ...
  1153. ...
  1154.  
  1155. ----------------------------------------------------------------------------
  1156.  
  1157. $$ ICN#,ID,ATTR,NAME
  1158. (32) ICON1_BYTE_LONGS    lexp    icon bit map - 32 longs:
  1159. ...
  1160. ...
  1161. (32) ICON2_BYTE_LONGS    lexp    icon bit map mask - 32 longs:
  1162. ...
  1163. ...
  1164.  
  1165. ----------------------------------------------------------------------------
  1166.  
  1167. $$ MENU,ID,ATTR,NAME
  1168. WIDTH_HOLDER        wexp    0 - placeholder for menu width
  1169. HEIGHT_HOLDER        wexp    0 - placeholder for menu height
  1170. STD_MENU_PROC_HOLDER    lexp    normally 0
  1171. ENABLE_MASK        lexp    bit 0 set if menu enabled,
  1172.                   bit 1 set if menu item 1 enabled,
  1173.                   bit 2 set if menu item 2 enabled,
  1174.                   etc...
  1175. MENU_TITLE        str    the menu's title
  1176. NUMBER_MENU_ITEMS    wexp    number of items in the menu:
  1177.  
  1178. For each menu item:
  1179. MENU_ITEM        str    the text of the item
  1180. ICON_NUMBER        bexp    0 = none, ICON'S resc ID = ICON number + 256
  1181. KEYBD_EQUIV        bexp    equivalent kybd char code, 0 = none
  1182. MARKING_CHAR        bexp    marking char code, 0 = no mark
  1183. TEXT_STYLE        bexp    text style of the item:
  1184.                     bit 0 = bold
  1185.                     bit 1 = italic
  1186.                     bit 2 = underline
  1187.                     bit 3 = outline
  1188.                     bit 4 = shadow
  1189.                     bit 5 = condense
  1190.                     bit 6 = extend
  1191.  
  1192. ----------------------------------------------------------------------------
  1193.  
  1194. $$ PAT ,ID,ATTR,NAME
  1195. PATTERN_BYTES    lexp    two longs:
  1196.    "        lexp
  1197.  
  1198. ----------------------------------------------------------------------------
  1199.  
  1200. $$ PAT#,ID,ATTR,NAME
  1201. NO_OF_PATTERNS        wexp    the number of patterns in the list:
  1202.  
  1203. For each pattern:
  1204. PATTERN_BYTES        lexp    two longs:
  1205.    "            lexp
  1206.  
  1207. ----------------------------------------------------------------------------
  1208.  
  1209. $$ STR ,ID,ATTR,NAME
  1210. STRING            str
  1211.  
  1212. ----------------------------------------------------------------------------
  1213.  
  1214. $$ STR#,ID,ATTR,NAME
  1215. NO_OF_STRINGS        wexp    the number of strings in the list:
  1216.  
  1217. For each string:
  1218. STRING            str
  1219.  
  1220. ----------------------------------------------------------------------------
  1221.  
  1222. $$ WIND,ID,ATTR,NAME
  1223. TOP            wexp    bounds rectangle:
  1224. LEFT            wexp
  1225. BOTTOM            wexp
  1226. RIGHT            wexp
  1227. WINDOW_DEFINITION_ID    wexp    window type:
  1228.                     0  std doc window or modeless dialog     
  1229.                     box
  1230.                     1  alert box or modal dialog box
  1231.                     2  plain box
  1232.                     3  plain box with shadow
  1233.                     4  doc window without size box
  1234.                     16 rounded corner window
  1235. VISIBLE            wexp    boolean, initial state of window
  1236. GOAWAY            wexp    boolean, TRUE means window has a close box
  1237. REFCON            lexp    user defined value
  1238. TITLE            str    the window's title
  1239.  
  1240. ----------------------------------------------------------------------------
  1241.  
  1242. [[ XXXX,ID,ATTR,NAME    user defined resource
  1243. <DATA/CODE>        whatever you want
  1244. ...
  1245. ]]            don't forget the ender!
  1246.  
  1247. ----------------------------------------------------------------------------
  1248.  
  1249. **************************************************************************
  1250.             LINKING
  1251. **************************************************************************
  1252.  
  1253.     McLink is the linker portion of the McAssembly program. McLink links 
  1254. together .REL files produced by McAssembly and stores the result in a resource 
  1255. file. Depending on the contents of the .REL files, the resulting resource file 
  1256. is either a pure resource file or an executable application.
  1257.  
  1258.     (McAssembly can't link object files which are in the MDS or MPW 
  1259. formats. The reverse is also true. However, McAssembly can generate MPW format 
  1260. object files, and a utility is provided to those who register that will convert 
  1261. McAssembly object files to MDS object files.)
  1262.  
  1263.     The file you specify to McLink is actually a link specification file. 
  1264. It contains the names of the files to be linked and the name of the resulting 
  1265. output file. The specification file has the following format (each filename is 
  1266. on a separate line):
  1267.  
  1268.     * Lines starting with an asterisk are comments and are ignored.
  1269.     ...
  1270.     input .REL filename 1
  1271.     input .REL filename 2
  1272.     ...
  1273.     * Lines grouped by [...] are used to consolidate user-defined
  1274.     *     resources which are split up into several source modules
  1275.     *     into one resource. As follows...
  1276.     [
  1277.     input .REL filename 3
  1278.     input .REL filename 4
  1279.     ...
  1280.     ]
  1281.     % input resource filename n
  1282.     % input resource filename n+1
  1283.     ...
  1284.     * Lines starting with an '@' are path specifiers - they specify an HFS
  1285.     *     path to use to access all subsequent files
  1286.     @ pathname
  1287.     ...
  1288.     /output filename
  1289.  
  1290. The input files must be either McAssembly .REL files or resource files. The % 
  1291. character must be the first character of lines containing resource filenames to 
  1292. differentiate them from .REL files. If an input filename doesn't end in .REL 
  1293. and it's not a resource file, McLink adds .REL to the name before it tries to 
  1294. open the file. The output filename must be the last filename in the list and 
  1295. must be preceded by a slash character.
  1296.  
  1297.     Resource files are handled as follows: McLink copies all resources in 
  1298. the resource file to the linked output file. If a resource in the resource file 
  1299. is the same as a resource defined in a .REL file, the resource file copy will 
  1300. replace the .REL file copy in the output file. If a BNDL resource is copied, 
  1301. the output file's bundle bit is set.
  1302.  
  1303.     There are only two aspects of ordering that you must follow: 1.) the 
  1304. first data item in the first file that's linked must be the starting 
  1305. instruction of the program, and 2.) all resources must be linked after all code 
  1306. and/or data. If you attempt to link code after a resource has been linked you 
  1307. get an error message.
  1308.  
  1309. **************************************************************************
  1310.             SEGMENTING
  1311. **************************************************************************
  1312.  
  1313.     McAssembly lets you divide up your application into segments. To 
  1314. implement segmenting, you have to do two things: 1.) specify what routines in a 
  1315. particular module may be called from other segments, and 2.) specify the 
  1316. partitioning of the code into segments, i.e., what modules are in what 
  1317. segments. Item 1 is accomplished through the use of the JTBL pseudo-op and 
  1318. allows McLink to construct the jump table containing an entry for every 
  1319. cross-segment accessible routine. Item 2 is accomplished by a SEGMENT COMMAND 
  1320. LINE in your link specification file and tells McLink how to break up the code 
  1321. into segments. The JTBL pseudo-op is described earlier and the segment command 
  1322. line description follows.
  1323.  
  1324.     The Segment Command Line is a special command line in the link 
  1325. specification file. It has the following syntax:
  1326.  
  1327.     $ [P] [L]
  1328.  
  1329. The $ character tells the linker that this line is not the name of a file to be 
  1330. linked but is the start of a new segment. The segment command line writes all 
  1331. modules linked so far to the output file as one segment and groups all 
  1332. subsequent modules (until another segment command line) into a new segment. The 
  1333. P and L parameters specify the attributes of the new code segment. P specifies 
  1334. that the segment is to be "preloaded" and L specifies that the segment is to be 
  1335. "locked." The default for both of these parameters is "not preloaded" and "not 
  1336. locked." (Don't specify a segment command line for the first segment. McLink 
  1337. defaults the attributes for segment number one to "preloaded," "locked," and 
  1338. "purgeable.")
  1339.  
  1340.     Here's an example link specification file for an application that 
  1341. contains four code segments:
  1342.  
  1343.     MAIN
  1344.     $
  1345.     SEG2A
  1346.     SEG2B
  1347.     $ P
  1348.     SEG3
  1349.     $ L P
  1350.     SEG4
  1351.     /MAIN.APPL
  1352.  
  1353. In this example, MAIN is in segment one, SEG2A and SEG2B in segment two, SEG3 
  1354. in segment three, and SEG4 in segment four. All segments are purgeable; 
  1355. segments one, three and four are to be preloaded; and segments one and four are 
  1356. locked. The resulting application program is placed in the file MAIN.APPL.
  1357.  
  1358. **************************************************************************
  1359.             JOB FILES
  1360. **************************************************************************
  1361.  
  1362.     The File menu Run job choice in McAssembly operates on a Job 
  1363. Specification File. A job specification file contains a list of filenames to be 
  1364. assembled and linked to form an output file. By using a job specification file, 
  1365. you eliminate assembling each file separately and invoking the linker to link 
  1366. them.
  1367.  
  1368.     The format of a job specification file is a link specification file 
  1369. whose filenames have no suffixes (.ASM or .REL). In fact, a job specification 
  1370. file can be used as a link specification file, providing it specifies an output 
  1371. file in its last filename line. Here's an example of a job specification file:
  1372.  
  1373.     * This is a comment line
  1374.     * Assemble the file X.ASM if necessary:
  1375.     X
  1376.     * Assemble the file Y.ASM if necessary:
  1377.     Y
  1378.     * Assemble the file Z.ASM if necessary:
  1379.     Z
  1380.     * Put the linked X.REL, Y.REL and Z.REL files into the
  1381.     *    output file XYZ:
  1382.     /XYZ
  1383.  
  1384.     To understand what the job control manager does for this file, 
  1385. understand first that a job is run in two phases, an assembly phase and a link 
  1386. phase. The assembly phase assembles the files and the link phase links the 
  1387. resulting .REL files.
  1388.  
  1389.     During the assembly phase, the job control manager ignores any line in 
  1390. the specification file which starts with any of the characters *, $, or / or 
  1391. which is a blank line. These are comment lines and link control lines which 
  1392. have no meaning in assembly. Any other lines are assumed to contain a 
  1393. non-suffixed filename which is a candidate for assembly. For example, the first 
  1394. thing the job control manager does for this job file is to skip the first two 
  1395. lines because they're comment lines. It then operates on the line X. The job 
  1396. control manager looks to see if X.ASM is on the disk. Let's assume for the 
  1397. purposes of this example that X.ASM isn't on the disk. In this case, the job 
  1398. control manager assumes that X.REL exists and that you don't want to reassemble 
  1399. it. So the specification file line containing X is ignored.
  1400.  
  1401.     The next line is examined similarly. Let's assume the converse here - 
  1402. that Y.ASM does exist. The job control manager assembles Y.ASM if either one of 
  1403. the following two conditions is met: 1.) there is no Y.REL file on the disk, or 
  1404. 2.) the existing copy of Y.REL is out-of-date. (It's out-of-date if the 
  1405. modification date of Y.REL is earlier in time than the modification date of 
  1406. Y.ASM.) In either of these two cases, Y.ASM is assembled, creating a new copy 
  1407. of Y.REL. If Y.REL is up-to-date, then the specification line containing Y is 
  1408. skipped and no assembly is performed.
  1409.  
  1410.     Having disposed of the Y file line, the job control manager goes on to 
  1411. the Z file line. A similar analysis goes on as above and Z.ASM is assembled if 
  1412. necessary.
  1413.  
  1414.     Finally, the last line, /XYZ, is examined. The job control manager 
  1415. recognizes this as an output file specification line for the linker, so the 
  1416. linker is invoked. This ends the assembly phase of the job and begins the link 
  1417. phase.
  1418.  
  1419.     In the link phase, the linker links the files using the job 
  1420. specification file as the link specification file. After the link is complete, 
  1421. the job is done and control returns to the top level of McAssembly.
  1422.  
  1423.     If the /XYZ line doesn't exist in the job file, then the job control 
  1424. manager assumes that no link is desired and skips the linker phase of the job. 
  1425. This allows you to use job files for just assemblies.
  1426.  
  1427. **************************************************************************
  1428.             68020 ADDRESSING MODES
  1429. **************************************************************************
  1430.  
  1431. Here are the syntaxes for the new 68020 address modes, where
  1432.  
  1433.     bd        is the base displacement
  1434.     An or PC    is the base register
  1435.     Rn*s        is the index register and s = a scale factor of 1,2,4,8
  1436.                 (scale defaults to 1 if omitted)
  1437.     od        is the outer displacement
  1438.  
  1439. (The spaces in the following aren't necessary - they're just there to
  1440. visually show the components which may be specified or omitted.)
  1441.  
  1442.  
  1443.     ( bd,An ,Rn*s   )    addr reg indirect with base displacement
  1444.     (    An ,Rn*s   )    *** old 68000 address mode
  1445.     ( bd,An         )
  1446.     (    An         )    *** old 68000 address mode
  1447.  
  1448.     ([bd,An],Rn*s,od)    addr reg memory indirect, post-indexed
  1449.     ([   An],Rn*s,od)
  1450.     ([   An]     ,od)
  1451.     ([   An]        )
  1452.     ([bd,An]     ,od)
  1453.     ([bd,An]        )
  1454.  
  1455.     ([bd,An,Rn*s],od)    addr reg memory indirect, pre-indexed
  1456.     ([   An,Rn*s],od)
  1457.     ([   An]     ,od)
  1458.     ([   An]        )
  1459.     ([bd,An]     ,od)
  1460.     ([bd,An]        )
  1461.  
  1462.     ( bd,PC ,Rn*s   )    PC indirect with base displacement
  1463.     (    PC ,Rn*s   )
  1464.     ( bd,PC         )
  1465.     (    PC         )
  1466.  
  1467.     ([bd,PC],Rn*s,od)    PC memory indirect, post-indexed
  1468.     ([   PC],Rn*s,od)
  1469.     ([   PC]     ,od)
  1470.     ([   PC]        )
  1471.     ([bd,PC]     ,od)
  1472.     ([bd,PC]        )
  1473.  
  1474.     ([bd,PC,Rn*s],od)    PC memory indirect, pre-indexed
  1475.     ([   PC,Rn*s],od)
  1476.     ([   PC]     ,od)
  1477.     ([   PC]        )
  1478.     ([bd,PC]     ,od)
  1479.     ([bd,PC]        )
  1480.  
  1481. Notice that you can omit any of the address components except for the
  1482. base register component by simply not typing it. If you want to suppress
  1483. the base register, then specify either ZA or ZP for the An and PC components
  1484. of the address respectively. For example,
  1485.  
  1486.     (bd,ZP,Rn)    will suppress the PC base register
  1487.  
  1488. The base and outer displacements may be either word or long values.
  1489. McAssembly uses whichever size is appropriate based on the symbol's value.
  1490. You can't specify a particular size. Also, base and outer displacements
  1491. must be absolute symbols, except in the PC memory indirect modes, in which
  1492. case the base displacement must be a relocatable value.
  1493.  
  1494. **************************************************************************
  1495.             FILE SUFFIXES
  1496. **************************************************************************
  1497.  
  1498.     McAssembly requires certain suffixes on filenames as follows: (These 
  1499. can be in any combination of upper or lower case.)
  1500.  
  1501.     .asm    assembler source files
  1502.     .rel    assembler object files
  1503.     .lst    assembler listing files
  1504.     .psm    assembler packed symbol files
  1505.     .lnk    link specification file
  1506.     .job    job specification file or link specification file
  1507.     .map    linker listing output file
  1508.     .sym    binary symbol table output by the linker for use by McBug
  1509.  
  1510. **************************************************************************
  1511.             TRANSFER MENU NAMES
  1512. **************************************************************************
  1513.  
  1514.     The filenames in the Transfer Menu are changeable by the user using 
  1515. ResEdit. It works like this: Any STR resource in the McAssembly file with an ID 
  1516. of 1000 or greater is interpreted by McAssembly as a filename to be added to 
  1517. the Transfer Menu. You can edit or delete the supplied filenames, or add as 
  1518. many of your own as you like. The following special details apply to this 
  1519. process:
  1520.  
  1521.     *    A filename consisting of only a dash '-' generates a disabled
  1522.             line of dashes.
  1523.     *    A '/' before a character will make that character a command
  1524.             key equivalent for the transfer to that file.
  1525.     *    A '<' before a B,I,U,O, or S will make the style of the menu
  1526.             item bold, italic, underline, outline, or shadow
  1527.             respectively.
  1528.     *    If the file isn't in the same folder as McAssembly, then you
  1529.             must specify a full HFS pathname as in
  1530.             'Volname:Folder:Filename'.
  1531.     *    A filename can't be longer than 31 characters.
  1532.  
  1533. **************************************************************************
  1534.             MPW FORMAT
  1535. **************************************************************************
  1536.  
  1537.     McAssembly can create object files in the MPW format. The linker can't 
  1538. link them, but you can link them with the MPW linker. MPW object files will 
  1539. have the suffix '.o.' as opposed to the normal '.rel'.
  1540.  
  1541.     There are two special assembler pseudo-ops in MPW mode. You can use 
  1542. them in normal McAssembly mode, but they'll have no effect on the output files. 
  1543. These pseudo-ops and their descriptions are: 
  1544.  
  1545.     MAIN
  1546.  
  1547.     Identifies a module as being the main code and data module in the 
  1548. application. This causes two things to happen: 1.) The first instruction in the 
  1549. module will be the first instruction executed when the resulting linked 
  1550. application is executed, and 2.) Any A5SEC data in the module is guaranteed to 
  1551. be located immediately below A5. (This data placement is discussed in more 
  1552. detail below.)
  1553.  
  1554.     (In McAssembly, a "module" is equivalent to a source file. This is 
  1555. different than the MPW definition of a module, which allows any number of 
  1556. modules to be contained in one source file.)
  1557.  
  1558.     SEG    ["<segment name>"]
  1559.  
  1560.     Allows you to control the segmentation of your program. Only the last 
  1561. seg statement in a source file is effective. It causes all of the code 
  1562. generated by that file to be placed in a segment named segment name. Code which 
  1563. resides in any particular segment doesn't have to be linked consecutively - the 
  1564. MPW linker figures out what goes where and collects all segment code together 
  1565. regardless of what order the files are linked in. If you don't use a seg 
  1566. statement in a file or use a seg without a segment name then all of the code in 
  1567. the file is placed in a segment named Main by the  linker.
  1568.  
  1569.     (Again, this is slightly different than the MPW convention, which 
  1570. allows code in any one source file to be placed into any number of segments.)
  1571.  
  1572. RESTRICTIONS
  1573.  
  1574.     Just as there are some things you can do in the MPW assembler that you 
  1575. can't do in McAssembly, there are also some McAssembly features that can't be 
  1576. implemented with the MPW object format. Here's what you can't do in MPW mode:
  1577.  
  1578.     1.) The pseudo-ops A5OFF, FSIGN, and FTYPE are illegal in MPW mode.
  1579.  
  1580.     2.) None of the resource compiling capabilities can be used.
  1581.  
  1582.     3.) In McAssembly, you can branch to an externally defined symbol using 
  1583. the Bcc, BSR, and DBcc instructions. You can't do that in MPW. You have to use 
  1584. equivalent JSR and JMP instructions instead.
  1585.  
  1586. A5 DATA STORAGE
  1587.  
  1588.     The MPW linker has a slightly different perspective of A5 data 
  1589. allocation than MDS had - it's entirely under your control. This means that the 
  1590. linker has no provisions for allowing for the usual $100 bytes of QuickDraw 
  1591. global storage on top of your own A5 data. If your programs rely on this (and 
  1592. they do if they do an InitGraf !-4(A5) when they start up!), then you have to 
  1593. allocate this area specifically yourself. You can do it very simply like this
  1594.  
  1595.         a5sec
  1596.     <your own global variable definitions>
  1597.         ds.b    grafSize    QuickDraw's space
  1598.         a5end
  1599.  
  1600. but there are two important restrictions for this to work properly:
  1601.  
  1602.     1.) The grafSize bytes of A5 storage must be defined in the main module 
  1603. (the source file containing the main pseudo-op.) If it's not in the main 
  1604. module, then the linker will not necessarily place it immediately below A5.
  1605.  
  1606.     2.) The grafSize bytes of A5 storage must be the last A5 storage item 
  1607. defined in the main module. In other words, if you have several A5SEC's in your 
  1608. main file, then make sure that the grafSize bytes are the last A5SEC item in 
  1609. the file. (This is because McAssembly allocates A5 variables in reverse order 
  1610. of how they appear in the file - the first A5 variable is the lowest in memory, 
  1611. and the last is highest in memory.)
  1612.  
  1613.     (Notice that grafSize, which is defined in the QuickEqu system file, is 
  1614. only $CE bytes, not $100. GrafSize is all that's actually required. I think the 
  1615. $100 was just used for historical reasons as an arbitrarily large enough 
  1616. number.)
  1617.  
  1618. **************************************************************************
  1619.             USER-DEFINABLE .MAP FILES
  1620. **************************************************************************
  1621.  
  1622.     The McAssembly linker menu contains an option to save link .MAP files 
  1623. in a user-definable format. This is accomplished by the use of a resource 
  1624. containing the user-supplied formatting code. This resource is type UMAP, ID 
  1625. 128. If a .MAP file has been requested, and if the user .MAP file format is 
  1626. selected, then the linker communicates with the UMAP resource code to 
  1627. accomplish the writing of symbol table information to the .MAP file.
  1628.  
  1629.     The default user .MAP file format is an enhanced MDS format, and has 
  1630. been designed to work with Steve Jasik's debugger. It should probably also work 
  1631. with TMON. The source code for the UMAP resource is provided to all registered 
  1632. users so it can easily be modified to support other .MAP formats.
  1633.  
  1634. **************************************************************************
  1635.             CONFIGURATION RESOURCES
  1636. **************************************************************************
  1637.  
  1638.     The following resources affect McAssembly's operation, and may be 
  1639. changed to whatever you like:
  1640.  
  1641. STR,128    =    The four-character creator string for all text files created
  1642.         by McAssembly. For example, change this to 'QED1' if you use
  1643.         the QUED editor.
  1644.  
  1645. STR,129 =    A string which is sent to the printer before every print job.
  1646.         Change this to whatever your printer likes to see.
  1647.  
  1648.